import Vue from 'vue'
import VueRouter from 'vue-router'
import App from '@/App.vue'
import loginCom from '@/views/login-com'
import registerCom from '@/views/register-com'
import formListCom from '@/views/form-list-com'
import newFormCreateCom from '@/views/new-form-create-com'
import examResultCom from '@/views/exam-result-com'
import examResultDetailCom from '@/views/exam-result-detail-com'
import examResultProblemCom from '@/views/exam-result-problem-com'
import examResultShareCom from '@/views/exam-result-share-com'
import previewFormCom from '@/views/preview-form-com'
import userCenterCom from '@/views/user-center-com'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: App,
    children: [
      {
        name:'login',
        path: '/login',
        component: loginCom
      },
      {
        name:'register',
        path: '/register',
        component: registerCom
      },
      {
        name:'form-list',
        path: '/form-list',
        component: formListCom
      },
      {
        name:'new-form-create',
        path: '/new-form-create',
        component: newFormCreateCom
      },
      {
        name:'exam-result',
        path: '/exam-result',
        component: examResultCom,
        children:[
          {
            name:'detail',
            path: 'detail',
            component: examResultDetailCom
          },
          {
            name:'problem',
            path: 'problem',
            component: examResultProblemCom
          },
          {
            name:'share',
            path: 'share',
            component: examResultShareCom
          },
        ]
      },
      {
        name:'w',
        path: '/w',
        component: previewFormCom
      },
      {
        name:'user-center',
        path: '/user-center',
        component: userCenterCom
      },
      {
        path: '/',
        redirect: '/form-list',
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
